@typeparam TItem
@inherits _BaseDataGridRow<TItem>
<TableRow Clicked="@HandleClick"
          DoubleClicked="@HandleDoubleClick"
          Background="@(ParentDataGrid.EditState == DataGridEditState.None && (object)ParentDataGrid.SelectedRow == (object)Item ? Background.Primary : Background.None)"
          HoverCursor="@HoverCursor"
          Class="@Class"
          Style="@Style">
    @foreach ( var column in Columns )
    {
        @if ( column.ColumnType == DataGridColumnType.Command )
        {
            @if ( ParentDataGrid.Editable == true )
            {
                <_DataGridRowCommand TItem="TItem" Item="@Item" EditState="DataGridEditState.None" Edit="@OnEditCommand" Delete="@OnDeleteCommand" Save="@OnSaveCommand" Cancel="@OnCancelCommand" Class="@column.CellClass?.Invoke(Item)" Style="@column.CellStyle?.Invoke(Item)" Width="@column.Width" />
            }
        }
        else
        {
            <TableRowCell Class="@column.CellClass?.Invoke(Item)" Style="@column.CellStyle?.Invoke(Item)" width="@column.Width" TextAlignment="@column.TextAlignment">
                @if ( column.DisplayTemplate != null )
                {
                    @column.DisplayTemplate( Item )
                }
                else
                {
                    @column.FormatDisplayValue( Item )
                }
            </TableRowCell>
        }
    }
</TableRow>